//
//  NSString+SizeOfString.m
//  Pro_1
//
//  Created by LuoYao on 16/6/21.
//  Copyright © 2016年 LuoYao. All rights reserved.
//

#import "NSString+SizeOfString.h"

@implementation NSString (SizeOfString)
+ (CGSize)sizeOfString:(NSString *)string fontSize:(CGFloat)fontSize {
    CGSize size = [string boundingRectWithSize:CGSizeMake(KWIDTH * 0.9, KHEIGHT * 0.05) options:NSStringDrawingUsesLineFragmentOrigin attributes:@{NSFontAttributeName:[UIFont systemFontOfSize:fontSize]} context:nil].size;
    return size;
}

+(CGSize)textString:(NSString *)textString fontSize:(CGFloat)fontSize maxWidth:(CGFloat)maxWidth{
    CGRect rect = [textString boundingRectWithSize:CGSizeMake(maxWidth, CGFLOAT_MAX) options:NSStringDrawingUsesLineFragmentOrigin attributes:@{NSFontAttributeName:[UIFont systemFontOfSize:fontSize]} context:nil];
    return rect.size;
}

@end

